import Vue from 'vue'
import Router from 'vue-router'

const index = r => require.ensure([], () => r(require('../views/Index.vue')))
const indexWorkDynamicso = r => require.ensure([], () => r(require('../views/WorkDynamicso.vue')))
const indexWorkDynamicst = r => require.ensure([], () => r(require('../views/WorkDynamicst.vue')))

const colloge = r => require.ensure([], () => r(require('../views/Colloge.vue')))
const collogeInfo = r => require.ensure([], () => r(require('../views/CollogeInfo.vue')))

const idea = r => require.ensure([], () => r(require('../views/Idea.vue')))
const ideaTeacherInfo = r => require.ensure([], () => r(require('../views/TeacherInfo.vue')))
const ideaResultsInfo = r => require.ensure([], () => r(require('../views/ResultsInfo.vue')))
const ideaTeacherResource = r => require.ensure([], () => r(require('../views/TeacherResource.vue')))
const ideaResults = r => require.ensure([], () => r(require('../views/Results.vue')))
const ideaTrainMaterialList = r => require.ensure([], () => r(require('../views/TrainMaterialList.vue')))
const ideaTrainMaterialInfo = r => require.ensure([], () => r(require('../views/TrainMaterialInfo.vue')))

const training = r => require.ensure([], () => r(require('../views/Training.vue')))
const trainingTrainingInfo = r => require.ensure([], () => r(require('../views/TrainingInfo.vue')))
const trainingTrainingApply = r => require.ensure([], () => r(require('../views/TrainingApply.vue')))

const activeApply = r => require.ensure([], () => r(require('../views/ActiveApply.vue')))
const contact = r => require.ensure([], () => r(require('../views/Contact.vue')))
const login = r => require.ensure([], () => r(require('../components/Login.vue')))


const userCenter = r => require.ensure([], () => r(require('../views/userCenter.vue')))
const userCenterInfo = r => require.ensure([], () => r(require('../views/userCenterInfo.vue')))
const personalColloge = r => require.ensure([], () => r(require('../views/personalColloge.vue')))
const personalCollogeInfo = r => require.ensure([], () => r(require('../views/personalCollogeInfo.vue')))
const personalTraining = r => require.ensure([], () => r(require('../views/personalTraining.vue')))
const personalTrainingInfo = r => require.ensure([], () => r(require('../views/personalTrainingInfo.vue')))
const wxLogin = r => require.ensure([], () => r(require('../views/wxLogin.vue')))

Vue.use(Router)

let router= new Router({
  routes: [{
      //主页
      path: '/',
      component: index,
    },
    {
      //主页
      path: '/index',
      component: index,
    },
    //工作状态一
    {
      path: '/indexWorkDynamicso',
      component: indexWorkDynamicso
    },
    // 工作状态二
    {
      path: '/indexWorkDynamicst',
      component: indexWorkDynamicst
    },

    {
      //书院
      path: '/colloge',
      component: colloge,
    },
    {
      //书院详情
      path: '/collogeInfo',
      component: collogeInfo,
    },



    //团青智库
    {
      path: '/idea',
      component: idea
    },
    //教师详情
    {
      path: '/ideaTeacherInfo',
      component: ideaTeacherInfo
    },
    //研究成果详情
    {
      path: '/ideaResultsInfo',
      component: ideaResultsInfo
    },
    //教师资源
    {
      path: '/ideaTeacherResource',
      component: ideaTeacherResource
    },
    //科研成果
    {
      path: '/ideaResults',
      component: ideaResults
    },
    //培训资料
    {
      path: '/ideaTrainMaterialList',
      component: ideaTrainMaterialList
    },
     //培训详情
    {
      path: '/ideaTrainMaterialInfo',
      component: ideaTrainMaterialInfo
    },

    //开班信息
    {
      path: '/training',
      component: training
    },
    //培训详情
    {
      path: '/trainingTrainingInfo',
      component: trainingTrainingInfo
    },
    //申请报名
    {
      path: '/trainingTrainingApply',
      component: trainingTrainingApply
    },


    //活动报名
    {
      path: '/activeApply',
      component: activeApply
    },



    //联系我们
    {
      path: '/contact',
      component: contact
    },
    //登录
    {
      path: '/login',
      component: login
    },
    {
      path: '/wxLogin',
      component: wxLogin
    },

    //个人中心
    {
      path: '/userCenter',
      component: userCenter
    },
    //个人资料
    {
      path: '/userCenterInfo',
      component: userCenterInfo
    },
    {
      path: '/personalColloge',
      component: personalColloge
    },
    {
      path: '/personalCollogeInfo',
      component: personalCollogeInfo
    },
    {
      path: '/personalTraining',
      component: personalTraining
    },
    {
      path: '/personalTrainingInfo',
      component: personalTrainingInfo
    },


    // //活动详情
    // {
    //   path: '/activeInfo',
    //   component: activeInfo
    // },
  ]
})
// 路由切换前调用
router.beforeEach((to, from, next) => {
  if(router.app.rootInfo){
    router.app.rootInfo.showFooter=true;
    router.app.rootInfo.showHeader=true;
    router.app.rootInfo.activeAction=to.path;
  }
  next()
})
export default router
